package com.sky.mapper;


import com.sky.entity.AddressBook;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AddressBookMapper {

    // 插入数据  太长了放到xml文件中
    void insert(AddressBook addressBook);

    //根据参数动态查询
    List<AddressBook> selectAll(AddressBook addressBook);

    @Delete("delete from address_book where id = #{id} and user_id = #{userId}")
    void delete(AddressBook addressBook);

    //修改数据
    void update(AddressBook addressBook);

    //根据主键id查询
    @Select("select * from address_book where id = #{addressBookId}")
    AddressBook queryById(Long addressBookId);
}
